/**
 *
 * 请求词汇列表代理类
 *
 */

package com.ilovetolearn.business
{
	import com.adobe.cairngorm.business.ServiceLocator;
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.ilovetolearn.event.InitializeSentenceEvent;
	import com.ilovetolearn.vo.InitializeSentenceVo;

	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;
	import mx.rpc.http.HTTPService;

	public class InitializeSentenceDelegate implements IResponder
	{
		private var _responder:IResponder;
		private var _httpservice:HTTPService

		public function InitializeSentenceDelegate(responder:IResponder)
		{
			this._responder=responder;
			this._httpservice=ServiceLocator.getInstance().getHTTPService("ss");
		}

		public function initializeSentence(e:CairngormEvent):void
		{
			var event:InitializeSentenceEvent=e as InitializeSentenceEvent;
			var vo:InitializeSentenceVo=event.params;
			this._httpservice.url+=vo.toParamString();
			this._httpservice.resultFormat="text";
			var token:AsyncToken=this._httpservice.send();
			token.addResponder(this);
		}

		public function result(data:Object):void
		{
			_responder.result(data);
		}

		public function fault(info:Object):void
		{
			_responder.fault(info);
		}
	}
}